package com.qyhl.webtv.module_microvideo.shortvideo.classic.detail.introduction;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.makeramen.roundedimageview.RoundedImageView;
import com.qyhl.webtv.basiclib.base.BaseFragment;
import com.qyhl.webtv.commonlib.entity.microvideo.ClassicProgramBean;
import com.qyhl.webtv.module_microvideo.R;
import com.qyhl.webtv.module_microvideo.R2;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ClassicIntroductionFragment extends BaseFragment {
    @BindView(R2.id.head_cover)
    RoundedImageView headCover;
    @BindView(R2.id.name)
    TextView name;
    @BindView(R2.id.summary)
    TextView summary;
    @BindView(R2.id.description)
    TextView description;
    private View view;

    private ClassicProgramBean mBean;

    public void setBean(ClassicProgramBean mBean) {
        this.mBean = mBean;
    }

    public static ClassicIntroductionFragment newInstance(ClassicProgramBean bean) {
        ClassicIntroductionFragment fragment = new ClassicIntroductionFragment();
        fragment.setBean(bean);
        return fragment;
    }

    @Override
    protected View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (view == null) {
            view = inflater.inflate(R.layout.micro_fragment_classic_introduction, null);
            ButterKnife.bind(this, view);
        }
        return view;
    }

    @Override
    protected void create() {
        name.setText(mBean.getTeacherName());

        summary.setText(mBean.getTeacherDesc());

        description.setText(mBean.getDesc());

        Glide.with(this)
                .load(mBean.getTeacherAvatar())
                .apply(new RequestOptions().error(R.drawable.comment_head_default).placeholder(R.drawable.comment_head_default))
                .into(headCover);
    }

    @Override
    protected void setListener() {

    }

    @Override
    protected void onFirstVisible() {

    }

    @Override
    protected void onVisible() {

    }

    @Override
    protected void onHide() {

    }
}
